var app = angular.module('conversionTool', ['smart-table']);

app.controller('ManageConnectionCtrl', [ '$scope', '$http', function($scope, $http) {

	$scope.itemsByPage=10;
	
	$scope.soapConnections=[];
	
	$scope.soapConnectionsDisplay=[].concat($scope.soapConnections);

	$scope.initial = function() {

		$http.post('/rest/soap/getAllconnection').success(function(data) {

			$scope.soapConnections = data;
			
			$scope.soapConnectionsDisplay=[].concat($scope.soapConnections);

		}).error(function(data) {
			console.log(data);
		});

	}

	$scope.initial();

	$scope.showDetail = function(id) {

		document.getElementById("id").value=id;

		
	}

	$scope.deleteConnection = function(id) {

		$http.post('/rest/soap/deleteSoapConnection', {
			"id" : id
		}).success(function(data) {
			$scope.msg = "delete success!";
			$scope.initial();

		}).error(function(data) {
			console.log(data);
		});

	}

} ]);